<include file="Public:header"/>
<include file="Public:left"/>
<style>
	td {
		text-align: center;
	}
</style>
<style type="text/css" src="__STATIC__/admin/css/style.css" ></style>
<section>
	<div class="page_title">
		<h2 class="fl" style="margin-right: 10px">会员列表 </h2>
	<!--	<a  style="float: left;margin: 0 10px 0 10px" href="{:url('member/export')}">导出excel</a>-->
		<form action="">  会员状态：
			<select name="status">
				<option value="">全部状态</option>
				<option value="0" <eq name="status" value="0">selected </eq>>禁止状态</option>
				<option value="1" <eq name="status" value="1">selected </eq>>正常状态</option>
			</select>
			会员类型：
			<select name="type">
				<option value="">全部会员</option>
				<option value="1" <eq name="type" value="1">selected </eq>>银卡会员</option>
				<option value="2" <eq name="type" value="2">selected </eq>>金卡会员</option>
				<option value="3" <eq name="type" value="3">selected </eq>>铂金卡会员</option>
				<option value="4" <eq name="type" value="4">selected </eq>>黑金卡会员</option>
			</select>
			<input type="text" class="page_title_input" name="keyword" placeholder="可搜索昵称或手机号码" value="{$keyword}">
			<input  class="page_title_submit" type="submit" value="搜索">
			<input  class="page_title_submit" name="export" type="submit" value="导出">
		</form>

	</div>
	<table class="table">
		<tr>
			<th>会员ID</th>
			<th>会员资料</th>
			<th>手机号</th>
			<th>会员类型</th>
			<th>状态</th>
			<th>成交订单数</th>
			<th>成交金额</th>
			<th>注册时间</th>
			<th>操作</th>
		</tr>
		<volist name="list" id="vo" key="k">
			<tr>
				<td>{$vo.id}</td>
				<td><!--<img src="{$vo.wx_avatar}" style="height: 20px;">-->{$vo.nickname}</td>
		<td>{$vo.mobile}</td>
				<td>
					<select name=""  class="grade" data-id="{$vo.id}">
						<option value="1"  <eq	name="vo.type" value="1">selected</eq> >银卡会员</option>
						<option value="2"  <eq	name="vo.type" value="2">selected</eq>>金卡会员</option>
						<option value="3"  <eq	name="vo.type" value="3">selected</eq>>铂金卡会员</option>
						<option value="4"  <eq	name="vo.type" value="4">selected</eq>>黑金卡会员</option>
					</select>
				</td>
				<td>
					<if condition="$vo['status'] eq '0'">
					拉黑状态
					<else/>
					正常状态
					</if>
				</td>
				<td><?php echo sprintf("%.2f",db("order")->where("uid=".$vo['id']." and status=2")->count());?></td>
				<td><?php echo sprintf("%.2f",db("order")->where("uid=".$vo['id']." and status=2")->sum("price"));?></td>
				<td>{$vo.register_time|date="Y-m-d H:i:s",###}</td>
				<td>
					<p style="height: 40px;line-height: 40px;text-align: center;">
					<if condition="$vo['status'] eq '1'">
					<a onclick="return confirm('确定设置黑名单？')" href="{:url('member/setblack',array('id'=>$vo['id'],'status'=>0))}" class="inner_btn">拉黑</a>
					</if>
					<if condition="$vo['status'] eq '0'">
					<a onclick="return confirm('确定取消黑名单？')" href="{:url('member/setblack',array('id'=>$vo['id'],'status'=>1))}" class="inner_btn">取消拉黑</a>
					</if>
					</p>
				</td>
			</tr>
		</volist>
	</table>
</section>
	{$list->render()}
<script>
	$(document).ready(function() {
		//tab
		$(".admin_tab li a").click(function() {
			var liindex = $(".admin_tab li a").index(this);
			$(this).addClass("active").parent().siblings().find("a").removeClass("active");
			$(".admin_tab_cont").eq(liindex).fadeIn(150).siblings(".admin_tab_cont").hide();
		});
		$(".grade").change(function(){
			var status=$(this).val();
			if(confirm("确认操作？")) {
				$.post("{:url('member/grade')}", {status: $(this).val(), id: $(this).data('id')}, function (result) {
					if (result != 1) {
						alert('系统繁忙，稍后再试');
					}
				});
			}
		})
	});
</script>

</div>
</section>
</body>

</html>